﻿<UserControl x:Class="Reader.View.TopView" 
                 xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls" 
                 xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
                 xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
                    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
                    xmlns:samplesCommon="clr-namespace:OnlineBookReader;assembly=OnlineBookReader"                  
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
                Loaded="Page_Loaded" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" FontSize="14">
    <StackPanel>
        <data:DataGrid Name="topGrid" AutoGenerateColumns="False" ItemsSource="{Binding}" HorizontalAlignment="Stretch" LoadingRow="topGrid_LoadingRow">
            <data:DataGrid.Columns>
                <data:DataGridTextColumn Header="排名" Binding="{Binding Order}"/>
         <data:DataGridTextColumn Header="类别"  Binding="{Binding Path=Catalog, TargetNullValue=''}"/>
                <data:DataGridTemplateColumn Header="小说书名">
                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <HyperlinkButton CommandParameter="{Binding Uri}"  Content="{Binding BookName}" Click="HyperlinkButton_Click" />
                        </DataTemplate>
                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>

                <data:DataGridTemplateColumn Header="最新章节">
                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <HyperlinkButton CommandParameter="{Binding LastChapterUri}"  Content="{Binding LastChapterName}" Click="HyperlinkButton_Click_1" />
                        </DataTemplate>
                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>
                <data:DataGridTextColumn Header="作者" Binding="{Binding Author}"/>
                <data:DataGridTextColumn Header="更新日期" Binding="{Binding LastUpdateTime}"/>
            </data:DataGrid.Columns>
        </data:DataGrid>
    </StackPanel>
</UserControl>
